<?php
	require_once '../../Helpers/PathHelper.php';
	require_once  '../../Helpers/DbHelper.php';
	require_once  '../../Controllers/StudentController.php';
	require_once  '../../Controllers/UserController.php';
  //
  $u = new UserController();
  $u->evaluatePagePermission(UserController::STUDENT);
  //
  if(isset($_SESSION))
	  $uid = $_SESSION['loggedUser']['UserId'];
	//
	if(isset($uid))
	{
	  $s = new StudentController();
  	$details = $s->read($uid);

  	while($rows = mysql_fetch_assoc($details))
  	{
  	  $id = $rows['StudentId'];
  	  $name = $rows['Name'];
  	  $totalFees = $rows['TotalFees'];
  	}
  	//Compute remaining balance.
  	$a = new StudentController();
  	$balance = $a->getRemainingBalance($uid);
	}
?>
<html>
  <head>
    <title>Student :: Profile</title>
    <?php
      require_once '../commons.php';
      renderHeaderStyles() ;
    ?>
  </head>
  <body>
  <div class="admin-container">
    <?php renderStudentView();?>
  </div>
  <div class="container">
		<div class="inner">
		  <h1>STUDENT PROFILE</h1>
      <table align="center" class="inner">
      <tr>
        <td><label for="student-id">ID:</label></td>
        <td><?php echo $id?></td>
      </tr>
      <tr>
        <td><label for="student-name">Name:</label></td>
        <td><?php echo $name?></td>
      </tr>
      <tr>
        <td><label for="student-balance">Balance:</label></td>
        <td><?php echo $balance;?></td>
      </tr>
      <tr><td>&nbsp;</td></tr>
    </table>
		</div>
	</div>
	</body>
</html>